<!-- Begin: Wrapper Header -->
<div class="header hidden">
    <? Shell::showWidgets('wrapper-header') ?>
</div> <!-- End -->

<!-- Begin: Sidebar Left -->
<div class="sidebar left">
    <? Shell::showWidgets('sidebar-left') ?>                
</div> <!-- End -->

<!-- Begin: Content Search Products -->
<div class="content search-products">
    <div class="header"><h1>Produtos e Serviços</h1></div>
    <div class="banners-lateral">
        <span>Publicidade</span>
        <ul>
            <?
            if (isset(LayoutPage::$banners['lateral2'])):
                $banners = LayoutPage::$banners['lateral2'];
                foreach ($banners as $banner):
                    if ($banner == null):
                        ?>
                        <li>
                            <a href="javascript:;">
                                <img src="<?= _BNN_IMG_ ?>lateral2.jpg" alt="Banner" />
                            </a>
                        </li>
                        <?
                    else:
                        ?>
                        <li>
                            <?
                            if (strtolower(pathinfo($banner->filepicture, PATHINFO_EXTENSION)) == 'jpg'):
                                if (!$banner->id_enterprise):
                                    ?>
                                    <a href="<?= $banner->href ?>" target="<?= $banner->target ?>">
                                    <? else: ?>
                                        <a href="<?= __BASE_URI__ . 'revenda/' . urlencode(strtolower(str_replace(' ', '-', $banner->fancyname))) . '/' . $banner->e_id ?>">
                                        <? endif ?>
                                        <img src="<?= _BNN_IMG_ . $banner->filepicture ?>" alt="Banner" />
                                    </a>
                                <? else: ?>
                                    <object width="120" height="60">
                                        <param name="src" value="<?= _BNN_IMG_ . $banner->filepicture ?>">
                                        <param name="wmode" value="opaque">
                                        <embed src="<?= _BNN_IMG_ . $banner->filepicture ?>" width="120" height="60"></embed>
                                    </object>
                                    <? if (!$banner->id_enterprise): ?>
                                        <a class="flash" href="<?= $banner->href ?>" target="<?= $banner->target ?>"></a>
                                    <? else: ?>
                                        <a class="flash" href="<?= __BASE_URI__ . 'revenda/' . urlencode(strtolower(str_replace(' ', '-', $banner->fancyname))) . '/' . $banner->e_id ?>"></a>
                                    <?
                                    endif;
                                endif;
                                ?>
                        </li>
                    <?
                    endif;
                endforeach;
            endif
            ?>
        </ul>
    </div>
    <p class="announce">Há <strong><?= SearchProducts::$pagination->num_rows ?></strong> anúncios de produtos que atendem a sua busca:</p>

    <form id="search-products">
        <label>Busca por nome:</label>
        <input class="input" type="text" name="keywords" title="Busca por nome">
        <label class="category">Busca por categoria:</label>
        <select name="category" title="Busca por Categoria">
            <option value=""></option>
            <? foreach (DbGet::products_categories() as $d) { ?>
                <option value="<?= $d->url; ?>"><?= $d->name; ?></option>
            <? } ?>
        </select>
        <input class="submit" type="submit" value="Enviar">
    </form>
    <div class="pages-menu">
        <?= SearchProducts::$pagination->html ?>
    </div>
    <div class="pagination">
        <? if (!empty(SearchProducts::$data)): ?>
            <ul>
                <? foreach (SearchProducts::$data as $product): ?>
                    <li>
                        <a href="<?= __BASE_URI__ . 'produto/' . $product->p_id ?>">
                            <img class="thumb" src="<?= _PDT_IMG_ ?>last-updated/<?= $product->ptop_filepicture ?>" alt="" />
                        </a>
                        <a href="<?= __BASE_URI__ . 'produto/' . $product->p_id ?>">
                            <h2><?= $product->p_name ?></h2>
                        </a>
                        <p class="price">R$ <?= Util::format_money($product->price) ?></p>
                    </li>
                <? endforeach ?>
            </ul>
        <? else: ?>
            <p class="notfound">Nenhum produto ou serviço foi encontrado</p>
        <? endif ?>
    </div>
    <div class="pages-menu bottom">
        <?= SearchProducts::$pagination->html ?>
    </div>
</div> <!-- End -->
